﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using DAL;

namespace PeisongWeb.admin.controls
{
    public partial class sellerPrice : System.Web.UI.UserControl
    {
        public int proId
        {
            get
            {
                int tmp;
                try { tmp = Convert.ToInt32(ViewState["proId"]); }
                catch { tmp = 0; }
                return tmp;
            }
            set
            { ViewState["proId"] = value; }
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
               
                //PriceSellerEntity psNew = logic.priceSeller.getNotUsedByProduct(proId);
                //if (psNew.PsId != 0)
                //{
                //    lbl_NewPrice.Text = logic.company.getById(psNew.SellerId).Company + " ￥" + string.Format("{0:F2}", psNew.SellerPrice);
                //    hd_newPsId.Value = psNew.PsId.ToString();
                //}

                //PriceHistoryEntity ph = logic.priceHistory.getByProduct(proId);
                //if (ph.PhId != 0)
                //{                   
                //    hd_currentpsId.Value = ph.PsId.ToString();
                //    hd_currentphId.Value = ph.PhId.ToString();                   
                //}


                //PriceEntity pr = logic.price.getByProduct(proId);

                //if (pr.Price != 0)
                //{
                    
                //    span_Company.InnerHtml = logic.company.getById(pr.CompanyId).Company + "   ￥" + string.Format("{0:F2}", pr.SellerPrice);
                //    txt_Price.Text = string.Format("{0:F2}", pr.Price);
                //    ProductEntity pro=logic.product.getById(proId);
                //    if (pro.IsAutoPrice)
                //    {
                //        span_label.InnerHtml = string.Format("{0:F2}", pr.SellerPrice*(1+pro.AutoAdd));
                //        span_label.Visible = true;
                //        span_text.Visible = false;
                //    }
                //    else
                //    {
                //        span_label.Visible = false;
                //        span_text.Visible = true;
                //    }

                    
                //}
            }
        }
    }
}